Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Test #1

wants to merge 4 commits into from

Conversation

shruthidasarapu
Copy link

No description provided.

const [selectedPort, setSelectedPort] = useState("");
const [addedPorts, setAddedPorts] = useState<Port[]>([]);
const [offset, setOffset] = useState(0);
const [fetchData, setFetchData] = useState([]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This data is stored in the Redux store. Why are you duplicating it here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your feedback John. I removed the duplicates from here. Please check the latest changes.

}
function VoyagePlanner(params: VoyagePlannerParams) {
const [selectedPort, setSelectedPort] = useState("");
const [addedPorts, setAddedPorts] = useState<Port[]>([]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added ports are in the redux store. Where are you duplicating here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also removed here. Please check the latest changes.

<h2>Voyage</h2>
{addedPorts &&
addedPorts.map((item, key) => {
return <div key={key}>{item.name}</div>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low effort here. Remove port functionality? Re-arrange? No styling

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this part as well.

.getState()
.ports.ports.filter((item: Port) => item.name === selectedPort);
dispatch(addPorts(portTobeAdded[0]));
setAddedPorts(store.getState().voyage.ports);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed requirement to calculate estimated time of arrival, distance travelled.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also added the functionality for distance and estimated time of arrival here. Please check the latest code.

export function portsReducer(state = initialState, action: AnyAction): PortsState {
switch (action.type) {
case 'SETPORTACTION':
return { ...state, ports: action.portList }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are doing a paginated fetch - the ports should be appended, not replaced

Copy link
Author

@shruthidasarapu shruthidasarapu Jun 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I solved the issue here. Please check the latest changes which I made and let me know any further improvements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants